//230

Definition for a binary tree node.
public class TreeNode {
    int val;
    TreeNode left;
    TreeNode right;
    TreeNode() {}
    TreeNode(int val) { this.val = val; }
    TreeNode(int val, TreeNode left, TreeNode right) {
        this.val = val;
        this.left = left;
        this.right = right;
    }
}

class Sort implements Comparator{
  public int compare(Object o1, Object o2) {
      return (int)o2-(int)o1;
  }
}

class Solution {
  public int kthSmallest(TreeNode root, int k) {
      PriorityQueueInteger queue = new PriorityQueue(new Sort());
      fun(root, queue, k);
      return queue.poll();
  }

  public void fun(TreeNode root, PriorityQueueInteger queue, int n) {
      if (root == null) {
          return;
      }
      fun(root.left, queue, n);
      if (queue.size()  n) {
          queue.add(root.val);
      }
      if (queue.size() == n) {
          int a = queue.poll();
          queue.add(Math.min(a, root.val));
      }
      fun(root.right, queue, n);
  }
}
编写一个函数，输入是一个无符号整数（以二进制串的形式），返回其二进制表达式
中数字位数为 '1' 的个数（也被称为汉明重量）。

class Solution {
public:
    int hammingWeight(uint32_t n) 
    {
        int size = 0;
        int a = 1;
        for (int i = 0; i < 32; i++, n >>= 1)
        {
            if (n & a == 1)
            {
                size++;
            }
        }
        return size;
    }
};